import request from "@/utils/request";

export default {
  // 获取列表
  getList(query, current = 1, size = 20) {
    return request({
      // Promise
      url: "/article/category/search",
      method: "POST",
      data: {
        // {name: '前端', status: 1, current: current, size: size}
        ...query,
        current,
        size
      }
    });
  },
  // 删除
  delItem(id) {
    return request({
      url: `/article/category/${id}`,
      method: "DELETE"
    });
  },
  // 新增
  addItem(query) {
    return request({
      url: "/article/category",
      method: "POST",
      data: query
    });
  },
  // 查询单个
  findItem(id) {
    return request({
      url: `/article/category/${id}`,
      method: "GET"
    });
  },
  // 编辑
  editItem(query) {
    return request({
      url: "/article/category",
      method: "PUT",
      data: query
    });
  }
};
